// modules/Circle/src/utils/string/string.cpp
#include "../../../include/utils/string/String.h"
#include <algorithm>
#include <cctype>

namespace Circle {
    namespace Units {
        std::string trim(const std::string& str) {
            auto start = std::find_if(str.begin(), str.end(), [](unsigned char c) {
                return !std::isspace(c);
            });
            auto end = std::find_if(str.rbegin(), str.rend(), [](unsigned char c) {
                return !std::isspace(c);
            }).base();
            return (start < end) ? std::string(start, end) : std::string();
        }

        std::string removeAllSpaces(const std::string& str) {
            std::string result;
            for (char c : str) {
                if (!std::isspace(c)) {
                    result += c;
                }
            }
            return result;
        }
    }
}